﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Practices.EnterpriseLibrary.PolicyInjection;

using NCS.IConnect.ApplicationContexts;

using JM.JCY.BusinessFacade;
using JM.JCY.Common;
using JM.JCY.BusinessEntity;
using JM.JCY.BusinessEntity.DTOs.Notification;

namespace JM.JCY.Proxy
{
    public class NotificationProxy : JCYProxyBase<INotification>, INotification
    {
        private INotification GetInstance()
        {
            return PolicyInjection.Create<NotificationBF, INotification>();
        }

        public int InsertNotification(SingleNotification NotificationObj)
        {
            return this.GetInstance().InsertNotification(NotificationObj);
        }

        public int InsertNotifications(MultipleNotifications NotificationObj)
        {
            return this.GetInstance().InsertNotifications(NotificationObj);
        }

       //pass
        public NotificationDataSet.NotificationTableDataTable GetTopXNotifications(int staffID)
        {
            try
            {
                return GetInstance().GetTopXNotifications(staffID);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        //pass
        public NotificationDataSet.NotificationTableDataTable GetLastThirtyDaysNotifications(int staffID)
        {
            return GetInstance().GetLastThirtyDaysNotifications(staffID);
        }
        
        public void MarkAsRead(int[] NotificationIds)
        {
            this.GetInstance().MarkAsRead(NotificationIds);
        }

        public void MarkAllAsRead(string RecipientId)
        {
            this.GetInstance().MarkAllAsRead(RecipientId);
        }

        public int GetUnreadCount(int recipientId)
        {
            return this.GetInstance().GetUnreadCount(recipientId);
        }
    }
}
